<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="a_vuejs/vue.global.js"></script>

</head>
<body>

<div id="app">
    <h3>监听属性:监听计算属性</h3>
    改变message userName的值会被改变:<input type="text" v-model="message"><br/>
    用户名:{{userName}}
</div>

</body>

<script>
    Vue.createApp({
        data(){
            return{
                userName:''
            }
        },
        computed:{
            message:{
                get(){
                    return this.userName
                },
                set(v){
                    console.log('v->'+v)
                    this.userName = v
                }
            }
        },
        watch:{
            message(newValue,oldValue){
                console.log('message newValue:'+newValue)
                console.log('message oldValue:'+oldValue)
            }
        }
    }).mount("#app")
</script>

</html>